CC=g++
CFLAGS=-c -Wall -g -pedantic -std=c++0x
LDFLAGS=-lpthread
INCLUDE_FLAGS=-I/usr/local/include
EXE_SOURCES_CPP= nwprogclient.cpp nwprogserver.cpp nwprogproxy.cpp
UTIL_SOURCES_CPP=  HttpHelper.cpp AppLogger.cpp Utils.cpp WebServer.cpp HttpRequest.cpp HttpResponse.cpp \
	ProxyServer.cpp ProxySession.cpp Hop.cpp
UTIL_OBJECTS= $(UTIL_SOURCES_CPP:.cpp=.o) 
EXE_OBJECTS=$(EXE_SOURCES_CPP:.cpp=.o)
OBJECTS=$(UTIL_OBJECTS) $(EXE_OBJECTS) 
EXECUTABLE=nwprogclient nwprogserver nwprogproxy

all: $(EXECUTABLE)

$(EXECUTABLE): $(OBJECTS)
	$(CC) $(LDFLAGS) $(UTIL_OBJECTS)  $@.o -o $@

.cpp.o:
	$(CC) $(CFLAGS) $< -o $@ ${INCLUDE_FLAGS}

.c.o:
	$(CC) $(CFLAGS) $< -o $@ ${INCLUDE_FLAGS}

.PHONY: clean run UnitTest

clean:
	rm -f *.o *.log ${EXECUTABLE} core downloadedFile
